************************************************************************************************************************
*											 Reproduction code for: 												   *
**************** Voting for the Bündnis Sahra Wagenknecht (BSW) from a Policy Space Perspective, Study II **************
************************************** Nils Steiner & Sven Hillen ******************************************************
********************************************* German Politics **********************************************************
************************************************************************************************************************

/*
Instructions:
This do-file reproduces all findings reported in Study II of the article listed above.
To reproduce the findings, do the following:

1. Install ados and graph schemes used (if necessary), as follows
	ssc install fre
	ssc install esttab
	ssc install survwgt
	ssc install schemepack, replace all

2. Obtain the datasets used directly from GESIS   
	GLES (2023). GLES Panel 2016-2021, Wellen 1-21. GESIS, Köln. ZA6838 Datenfile Version 6.0.0, https://doi.org/10.4232/1.14114.
	GLES (2022). GLES Panel 2022, Welle 22. GESIS, Köln. ZA7728 Datenfile Version 1.0.0, https://doi.org/10.4232/1.13970.
	GLES (2023). GLES Panel 2022, Welle 23. GESIS, Köln. ZA7729 Datenfile Version 1.0.0, https://doi.org/10.4232/1.14064.	
	GLES (2023). GLES Panel 2023, Welle 24. GESIS, Köln. ZA7730 Datenfile Version 1.0.0, https://doi.org/10.4232/1.14141.	
	GLES (2024). GLES Panel 2023, Welle 25. GESIS, Köln. ZA7731 Datenfile Version 1.0.0, https://doi.org/10.4232/1.14242.	
	GLES (2024). GLES Panel 2024, Welle 26. GESIS, Köln. ZA7732 Datenfile Version 1.0.0, https://doi.org/10.4232/1.14349.	
	
3. Merge GLES Panel 2016-2021, waves 1-21: 
	Combine files to one dataset for sample "A" following the instructions from GESIS. 
	Run do-file from GESIS on this dataset to define missing values. 
	
4. Run do-file from GESIS on the other datasets for the individual waves to define missing values. 

5. Merge the datasets for the later individual waves to the dataset for waves 1-21 using the personal identifier "lfdn"
	For example:
	use ZA6838_allwaves_sA_v6-0-0_W1-21_mv.dta
	merge 1:1 lfdn using ZA7728_v1-0-0_mv.dta
	merge 1:1 lfdn using ZA7729_v1-0-0_mv.dta
	merge 1:1 lfdn using ZA7730_v1-0-0_mv.dta
	merge 1:1 lfdn using ZA7731_v1-0-0_mv.dta
	merge 1:1 lfdn using ZA7732_v1-0-0_mv.dta

6. Run the code below on the combined dataset
	For example:
	use "Dataset_GLES_Panel_W1-W26_mv.dta"	
*/


** # Bookmark #1
********************************************************************************
********************************** General settings ****************************
********************************************************************************
	clear all
	set more off, perm
	version 18.0
	set maxvar 10000
	set scheme white_tableau
	graph set window fontface "Times New Roman"
	
	
**# Bookmark #2
********************************************************************************	
********************************** Weighting ***********************************
********************************************************************************	
*** open combined dataset
	use "Dataset_GLES_Panel_W1-W26_mv.dta"	
	
***** Recalled vote choice in 2024 European Parliament election (for weight) *****
	* EP 2024 
	* vote choice variable (without non-voters)
	recode kp26_3032a (1=1 "CDU/CSU") (4=2 "SPD") (5=3 "FDP") (6=4 "Greens") (7=5 "LEFT") (322=6 "AfD") (392=7 "BSW") (801=8 "others"), gen(EPvote2024)
	label variable EPvote2024 "Vote choice EP 2024"
	
	* vote choice variable with non-voters
	clonevar EPvote2024_wabst = EPvote2024
	replace EPvote2024_wabst = 9 if kp26_3031 == 2
	label copy EPvote2024 EPvote2024_wabst
	lab define EPvote2024_wabst 9 "Abstention", modify
	label values EPvote2024_wabst EPvote2024_wabst

	* vote choice for BSW in 2024 EP election
	recode kp26_3032a (392=1 "BSW") (1/330 801=0 "other party"), gen(BSWvote_EU)

	
******* Create weight **********************************************************
	* -> based on existing post-stratification weight wei14_mz and recalled vote in EP 2024 election
		pwcorr EPvote2024_wabst wei*,obs
		* -> wei14_mz loses the least cases
	
	*** create weight based on voting behavior
		* create totals in population (vote totals from official statistics for Bundestagswahl 2021)
			* see: https://www.bundeswahlleiter.de/bundestagswahlen/2021/ergebnisse/bund-99.html 
		* CDU/CSU
		gen EPvote2024_wabst_num_tot=11949117 if EPvote2024_wabst==1		
		* Greens
		replace EPvote2024_wabst_num_tot=4738227 if EPvote2024_wabst==4
		* SPD
		replace EPvote2024_wabst_num_tot=5551545 if EPvote2024_wabst==2
		* FDP
		replace EPvote2024_wabst_num_tot=2061334 if EPvote2024_wabst==3
		* The Left
		replace EPvote2024_wabst_num_tot=1091586 if EPvote2024_wabst==5
		* AfD
		replace EPvote2024_wabst_num_tot=6325890 if EPvote2024_wabst==6
		* BSW
		replace EPvote2024_wabst_num_tot=2456460 if EPvote2024_wabst==7
		* other
		replace EPvote2024_wabst_num_tot=5416703  if EPvote2024_wabst==8
		* eligible but did not vote
		replace EPvote2024_wabst_num_tot=21848081 if EPvote2024_wabst==9
		
		*** create the weights based on the two poststratification weights
		* regular sample plus re-contact sample
		survwgt post wei14_mz, by(EPvote2024_wabst) totvar(EPvote2024_wabst_num_tot) gen(voteweight)
		* normalize
		sum voteweight
		replace voteweight=voteweight/(r(mean))
		sum voteweight

		*** Multiply weights (to use as fweights, where only integer values are accepted)
		gen voteweight_mult=100000000*voteweight
		
		*** Check		
		fre EPvote2024_wabst [aweight=voteweight]
		
		tab EPvote2024 [aweight=voteweight]
	
		
******* Survey set the data  ******************************
  svyset [pweight=voteweight]
	svy: proportion EPvote2024	


**# Bookmark #3
********************************************************************************	
********************************** Recoding ************************************
********************************************************************************		
	
********** Vote choice variables **********

	***** Intention to vote: If there was a federal election next Sunday, how likely is it that you will go to the polls?
		recode kp26_170 (5=0 "certain not to vote") (4=1) (3=2) (2=3) (1=4 "certain to vote"), gen(voteint26)
		recode kp25_170 (5=0 "certain not to vote") (4=1) (3=2) (2=3) (1=4 "certain to vote"), gen(voteint25)
		recode kp24_170 (5=0 "certain not to vote") (4=1) (3=2) (2=3) (1=4 "certain to vote"), gen(voteint24)
		
	***** Voting intention, national (Bundestag)
	* wave 26	
	* vote choice variable
	recode kp26_190ba (1=1 "CDU/CSU") (4=2 "SPD") (5=3 "FDP") (6=4 "Greens") (7=5 "LEFT") (322=6 "AfD") (392=7 "BSW") (801=8 "others"), gen(vote_nat_w26)
	label variable vote_nat_w26 "voting intention national (wave26)"
	* vote choice variable with non-voters
	clonevar vote_nat_w26_wabst = vote_nat_w26
	replace vote_nat_w26_wabst = 9 if voteint26 == 0 | voteint26 == 1
	label copy vote_nat_w26 vote_nat_w26_wabst
	lab define vote_nat_w26_wabst 9 "No intention to vote", modify
	label values vote_nat_w26_wabst vote_nat_w26_wabst
	* BSW dummy
	recode kp26_190ba (392=1 "BSW") (1/330 801=0 "other party"), gen(BSWvote_nat)
		
	* wave 25		
	* vote choice variable
	recode kp25_190ba (1=1 "CDU/CSU") (4=2 "SPD") (5=3 "FDP") (6=4 "Greens") (7=5 "LEFT") (322=6 "AfD") (801=8 "others"), gen(vote_nat_w25)
	label variable vote_nat_w25 "voting intention national (wave25)"		
	* vote choice variable with non-voters
	clonevar vote_nat_w25_wabst = vote_nat_w25
	replace vote_nat_w25_wabst = 9 if voteint25 == 0 | voteint25 == 1
	label copy vote_nat_w25 vote_nat_w25_wabst
	lab define vote_nat_w25_wabst 9 "No intention to vote", modify
	label values vote_nat_w25_wabst vote_nat_w25_wabst	
	
	* wave 24		
	* vote choice variable
	recode kp24_190ba (1=1 "CDU/CSU") (4=2 "SPD") (5=3 "FDP") (6=4 "Greens") (7=5 "LEFT") (322=6 "AfD") (801=8 "Others"), gen(vote_nat_w24)
	label variable vote_nat_w24 "voting intention national (wave24)"	
	* vote choice variable with non-voters
	clonevar vote_nat_w24_wabst = vote_nat_w24
	replace vote_nat_w24_wabst = 9 if voteint24 == 0 | voteint24 == 1
	label copy vote_nat_w24 vote_nat_w24_wabst
	lab define vote_nat_w24_wabst 9 "No intention to vote", modify
	label values vote_nat_w24_wabst vote_nat_w24_wabst
	
	

********** Policy positions *********
	* recode positions such that higher values correspond to right/nationalist/conservative positions
	
	***** Economic dimension
		* [kp25_2880d] The state should take measures to reduce differences in income levels
		fre kp25_2880d
		recode kp25_2880d (1=4 "right") (2=3) (3=2) (4=1) (5=0 "left"), gen(redistribution)
		
		* [kp25_2880g] The state should stay out of the economy
		fre kp25_2880g
		recode kp25_2880g (1=0 "left") (2=1) (3=2) (4=3) (5=4 "right"), gen(freeEcon)
		
		* [kp25_1090] Some people prefer lower taxes, although this results in less social services. Others prefer more social services, although this results in raising taxes.
		fre kp25_1090
		recode kp25_1090 (1=6 "right") (2=5) (3=4) (4=3) (5=2) (6=1) (7=0 "left"), gen(TaxvTran)
	
		*[kp25_2880bs] The state should strengthen rent regulations
		fre kp25_2880bs
		recode kp25_2880bs (1=4 "right") (2=3) (3=2) (4=1) (5=0 "left"), gen(rents)		
		
	***** Transnational dimension
		* [kp25_1130] Should it be easier or more difficult for foreigners to immigrate
		fre kp25_1130
		gen migration = kp25_1130-1
			label define migration 0 "liberal" 6 "authoritarian"
			label values migration migration
		
		* [kp25_1210] Some people think that foreigners should completely assimilate to the German culture. Others think that foreigners should be able to live according to their own culture
		fre kp25_1210
		recode kp25_1210 (1=6 "authoritarian") (2=5) (3=4) (4=3) (5=2) (6=1) (7=0 "liberal"), gen(assimilation)
		
		* [kp25_1250] Should the European unification be pushed further in order to establish a joint government soon or has the European unification already gone too far
		fre kp25_1250
		gen EU = kp25_1250-1
			label define EU 0 "liberal" 6 "authoritarian"
			label values EU EU					
			
	***** Morality dimension	
		* [kp25_2880bg] Same-sex partnerships should not be allowed to adopt children
		fre kp25_2880bg
		recode kp25_2880bg (1=0 "liberal") (2=1) (3=2) (4=3) (5=4 "authoritarian"), gen(adoption)
					
		* [kp25_2880cu] Every person should be able to determine his or her own gender and change it at the registry office
		fre kp25_2880cu
		recode kp25_2880cu (1=4 "authoritarian") (2=3) (3=2) (4=1) (5=0 "liberal"), gen(gndrchange)
					
		* [kp25_1590] Some think that state equality measures by no means go far enough, others think that they already go much too far today
		fre kp25_1590
		gen gndrequal = kp25_1590-1
			label values gndrequal EU
		
	
********** Factor analyses
	***** separately for each dimension 
		*** Economic dimension
		factor redistribution freeEcon TaxvTran [aweight=voteweight], pcf
			predict factor_econ
			label variable factor_econ "economic dimension"
	
		*** Transnational dimensions
		factor migration assimilation EU [aweight=voteweight], pcf
			predict factor_glob 
			label variable factor_glob "transnational dimension"
			
		*** Morality dimensions
		factor adoption gndrchange gndrequal [aweight=voteweight], pcf
			predict factor_morality
			label variable factor_morality "morality dimension"
	
		* Correlations between the dimensions
		pwcorr factor_econ factor_glob factor_morality [aweight=voteweight]
			
	***** with all at once
			* Table B1: Factor analysis with all items simultaneously included
			factor redistribution freeEcon TaxvTran migration assimilation EU adoption gndrchange gndrequal [aweight=voteweight], pcf
			rotate, promax blank(.3)	
	
	
********** Attitudinal control variables	
	***** Attitudes towards Russo-Ukrainian War	
		fre kp25_2880cq kp25_2880cl kp25_2880bk kp25_2880cd
		* Table B2: Measurement of attitudes towards Russo-Ukrainian war
		factor kp25_2880cq kp25_2880cl kp25_2880bk kp25_2880cd [aweight=voteweight], pcf 	
			predict RussoUkraineWar
			replace RussoUkraineWar=-RussoUkraineWar
		
	***** Populist attitudes
		* Table B3: Measurement of populist attitudes
		factor kp25_3103a kp25_3103b kp25_3103c kp25_3103d kp25_3103e kp25_3103f kp25_3103g kp25_3103h [aweight=voteweight], pcf
		predict populism
	
	*** [kp25_650y] Skalometer Wagenknecht
		fre kp25_650y
		gen Wagenknecht = kp25_650y-1 
			label define Wagenknecht 0 "schlecht" 10 "gut"
			label values Wagenknecht Wagenknecht
		recode Wagenknecht (0 1 2 3 4=0 "schlecht") (5=1 "neutral") (6 7 8 9 10=2 "gut"), gen(Wagenknecht_cat)
			
			
********** Sociodemographic control variables	
	***** Gender
		fre kpx_2280
		recode kpx_2280 (1=1 "male") (2=0 "female"), gen(male)
	
	***** Age groups
		fre kpx_2290s
		replace kpx_2290s="1955" if kpx_2290s=="1955 und frueher"
		destring kpx_2290s, gen(birthyear)
		gen age=2023-birthyear
		
		recode age (1/29=0 "Age: -29") (30/49=1 "Age: 30-49") (50/65=2 "Age: 50-65") (66/100=3 "Age: 66+"), gen(agegroup)
			
			* check
			tab age agegroup
			
	***** Education
		fre kp21_2320
		clonevar education=kp21_2320
			* replace with information from wave 9 (if missing)
			replace education=kp9_2320 if education>. & kp9_2320<.
			* replace with information from wave 1 (if missing)
			replace education=kp1_2320 if education>. & kp1_2320<.
		recode education (1 2=0 "Education: low") (3=1 "Education: medium") (4 5=2 "Education: high") (9=.), gen(edu_cat)	
		
	***** East vs. West Germany
		fre ostwest
		recode ostwest (0=1 "East") (1=0 "West"), gen(east)	
	
			
********* Standardize variables
	foreach var of varlist factor_econ factor_glob factor_morality populism RussoUkraineWar Wagenknecht {
		sum `var' 
		gen `var'_st=(`var'-r(min))/(r(max)-r(min))
		}
	
	***** Label standardized variables
		label variable factor_econ_st "economic dimension"
		label variable factor_glob_st "transnational dimension"
		label variable factor_morality_st "morality dimension"		
		label variable populism_st "populism"
		label variable RussoUkraineWar_st "attitudes towards RUS-UKR war"
		label variable Wagenknecht_st "Wagenknecht like-dislike"	
	
	
**# Bookmark #4	
********************************************************************************	
**************************** DESCRIPTIVES **************************************
********************************************************************************			
	
*** How many BSW voters?	
	tab BSWvote_nat 
	tab BSWvote_nat [aweight=voteweight]
	
	tab BSWvote_EU [aweight=voteweight]
	
	
*** Figure B1: Voting intention in national election in June 2024 by voting intention in October 2023
	tab vote_nat_w25_wabst vote_nat_w26_wabst [aweight=voteweight], row
	
	capture drop rowfreq
	gen rowfreq="4.4%" if vote_nat_w25_wabst==1 & vote_nat_w26_wabst==7
	replace rowfreq="4.8%" if vote_nat_w25_wabst==2 & vote_nat_w26_wabst==7
	replace rowfreq="4.8%" if vote_nat_w25_wabst==3 & vote_nat_w26_wabst==7
	replace rowfreq="1.6%" if vote_nat_w25_wabst==4 & vote_nat_w26_wabst==7
	replace rowfreq="37.6%" if vote_nat_w25_wabst==5 & vote_nat_w26_wabst==7
	replace rowfreq="11.1%" if vote_nat_w25_wabst==6 & vote_nat_w26_wabst==7
	replace rowfreq="12.6%" if vote_nat_w25_wabst==8 & vote_nat_w26_wabst==7
	replace rowfreq="5.3%" if vote_nat_w25_wabst==9 & vote_nat_w26_wabst==7
	
	tab vote_nat_w25_wabst vote_nat_w26_wabst , row

	capture drop _merge
	spineplot vote_nat_w26_wabst vote_nat_w25_wabst [aweight=voteweight], percent mlabcolor(white) xlabel( , angle(045) axis(2)) mlabcolor(black) text(rowfreq, mlabsize(*1.3))  ///
			xtitle("Voting intention Bundestag in October 2023 in %", axis(1)) ytitle("Voting intention Bundestag in June 2024 in %", axis(2)) xtitle(" ", axis(2)) ///
			bar1(color(gs12)) bar2(color(gs8)) bar3(color(pink)) bar4(color(blue)) bar5(color(purple)) bar6(color(green)) bar7(color(gold)) bar8(color(red)) bar9(color(black))	name(FigureB1, replace)

	
*** Figure B2: Pairwise correlations between independent variables	
	corr factor_econ_st factor_glob_st factor_morality_st populism_st RussoUkraineWar_st Wagenknecht_st if e(sample) [aweight=voteweight]
		matrix corrmatrix=r(C)		
		heatplot corrmatrix, values(format(%9.2f)) color(hcl diverging, intensity(.6)) lower nodiagonal label xlabel( , angle(090)) legend(off)	name(FigureB2, replace)
	
	
**# Bookmark #5	
********************************************************************************	
**************************** MAIN REGRESSIONS **********************************
********************************************************************************	

***** Simple baseline regression: Policy positions -> BSW voting intention *****
	logit BSWvote_nat factor_econ_st factor_glob_st factor_morality_st i.male i.agegroup i.edu_cat ib1.east [pweight=voteweight]
		estadd fitstat
		eststo m0
			
	margins, dydx(factor_econ factor_glob factor_morality) post 
		eststo marg0		
		
	coefplot marg0, baselevel xline(0) level(95 90) ///
		mlabel mlabformat(%9.3f) mlabposition(12) mlabgap(*2.2) mlabsize(vsmall) ///
		name(Figure5, replace)
			
	graph combine Figure5, iscale(*1.4) name(Figure5, replace)		
		graph export Figure5.jpg, width(5000) fontface(TimesNewRoman) replace	
		graph export Figure5.pdf, replace			
		
		
***** Main regression: Interactions between previous voting intention and attitudinal variables
		* vote intention variable in particular order
		recode vote_nat_w25_wabst (5=1 "LEFT") (4=2 "Greens") (2=3 "SPD") (1=4 "CDU/CSU") (3=5 "FDP") ///
			(6=6 "AfD") (8=7 "others") (9=8 "no intention to vote"), gen(vote_nat_w25_wabst_ord)		
					
		logit BSWvote_nat ///
				c.factor_econ_st##i.vote_nat_w25_wabst_ord ///
				c.factor_glob_st##i.vote_nat_w25_wabst_ord ///
				c.factor_morality_st##i.vote_nat_w25_wabst_ord ///
				c.populism_st##i.vote_nat_w25_wabst_ord ///
				c.RussoUkraineWar_st##i.vote_nat_w25_wabst_ord ///
				i.male i.agegroup i.edu_cat ib1.east [pweight=voteweight]
				eststo m1
					estadd fitstat	
				
				capture drop included
				gen included=1 if e(sample)
					
				esttab m0 m1 using "TableB4.rtf", nomtitles b(a2) se(a2) star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nogaps scalars(r2_mz) label ///
					order(*vote_nat_w25_wabst_ord *factor_econ_st* *factor_glob_st* *factor_morality_st* *populism_st* *RussoUkraineWar_st*) replace			

					
		* Figure 6: Marginal effects on BSW voting intention by previous voting intention
		estimates restore m1
		margins, dydx(factor_econ_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo economic
		
		estimates restore m1
		margins, dydx(factor_glob_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo transnational			
			
		estimates restore m1
		margins, dydx(factor_morality_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo morality			

		estimates restore m1
		margins, dydx(populism_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo populism
		
		estimates restore m1
		margins, dydx(RussoUkraineWar_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo war				
		
		coefplot transnational, bylabel("transnational dim.") || economic, bylabel("economic dim.") || morality, bylabel("morality dim.") ///
			|| populism, bylabel("populism") || war, bylabel("Russo-Ukrainian War") ///
			coeflabel(8._at="no intention to vote" 7._at="others" 6._at="AfD" 5._at="FDP" 4._at="CDU/CSU" 3._at="SPD" 2._at="Greens" 1._at="LEFT") ///
			byopts(rows(2)) xline(0) level(95 90) ///
			name(Figure6, replace)
			
		graph combine Figure6, scale(*1.1) name(Figure6, replace)
			graph export Figure6.jpg, width(5000) fontface(TimesNewRoman) replace	
			graph export Figure6.pdf, replace				
		
				
	***** Figure 7: Predicted probabilities of vote switching to the BSW by previous voting intention and positions on the transnational/economic dimensions			
	*** left-leaning parties and positions on the transnational dimension
			* The Left 
			estimates restore m1
			margins, at(vote_nat_w25_wabst_ord=(1) factor_glob_st=(0 (0.1) 1))	
			marginsplot, addplot(hist factor_glob_st if vote_nat_w25_wabst_ord==1 & e(sample) [fweight=voteweight_mult], ///
				fraction bin(11) yaxis(2) yscale(alt range(0 0.5) lstyle(none) axis(2)) ytitle(" ", size(zero) axis(2)) ///
				ylabel(none, axis(2)) xlabel(0 (0.1) 1, gmin gmax) fcolor(%20) lcolor(%20)) ///
				recast(line) recastci(rarea) ///
				level(90) xlabel(0 (0.1) 1, gmin gmax) legend(off) ytitle("") title("The Left") name(Left, replace)
				
			* Greens 
			estimates restore m1
			margins, at(vote_nat_w25_wabst_ord=(2) factor_glob_st=(0 (0.1) 1))	
			marginsplot, addplot(hist factor_glob_st if vote_nat_w25_wabst_ord==2 & e(sample) [fweight=voteweight_mult], ///
				fraction bin(11) yaxis(2) yscale(alt range(0 0.5) lstyle(none) axis(2)) ytitle(" ", size(zero) axis(2)) ///
				ylabel(none, axis(2)) xlabel(0 (0.1) 1, gmin gmax) fcolor(%20) lcolor(%20)) ///
				recast(line) recastci(rarea) ///
				level(90) xlabel(0 (0.1) 1, gmin gmax) legend(off) ytitle("") title("Greens") name(Greens, replace)	
				
			* SPD				
			estimates restore m1
			margins, at(vote_nat_w25_wabst_ord=(3) factor_glob_st=(0 (0.1) 1))	
			marginsplot, addplot(hist factor_glob_st if vote_nat_w25_wabst_ord==3 & e(sample) [fweight=voteweight_mult], ///
				fraction bin(11) yaxis(2) yscale(alt range(0 0.5) lstyle(none) axis(2)) ytitle(" ", size(zero) axis(2)) ///
				ylabel(none, axis(2)) xlabel(0 (0.1) 1, gmin gmax) fcolor(%20) lcolor(%20)) ///
				recast(line) recastci(rarea) ///
				level(90) xlabel(0 (0.1) 1, gmin gmax) legend(off) ytitle("") title("SPD") name(SPD, replace)	
			
			* combine for left parties		
			graph combine Left Greens SPD, imargin(vsmall) row(1) iscale(*1.2) ysize(6) ycommon name(LeftParties, replace)		
				
				
	*** right-leaning parties and positions on the economic dimension
			* AfD
			estimates restore m1
			margins, at(vote_nat_w25_wabst_ord=(6) factor_econ_st=(0 (0.1) 1))	
			marginsplot, addplot(hist factor_econ_st if vote_nat_w25_wabst_ord==6 & e(sample) [fweight=voteweight_mult], ///
				fraction bin(11) yaxis(2) yscale(alt range(0 0.5) lstyle(none) axis(2)) ytitle(" ", size(zero) axis(2)) ///
				ylabel(none, axis(2)) xlabel(0 (0.1) 1, gmin gmax) fcolor(%20) lcolor(%20)) ///
				recast(line) recastci(rarea) ///
				level(90) xlabel(0 (0.1) 1, gmin gmax) legend(off) ytitle("") title("AfD") name(AfD, replace)
				
			* FDP 
			estimates restore m1
			margins, at(vote_nat_w25_wabst_ord=(5) factor_econ_st=(0 (0.1) 1))	
			marginsplot, addplot(hist factor_econ_st if vote_nat_w25_wabst_ord==5 & e(sample) [fweight=voteweight_mult], ///
				fraction bin(11) yaxis(2) yscale(alt range(0 0.5) lstyle(none) axis(2)) ytitle(" ", size(zero) axis(2)) ///
				ylabel(none, axis(2)) xlabel(0 (0.1) 1, gmin gmax) fcolor(%20) lcolor(%20)) ///
				recast(line) recastci(rarea) ///
				level(90) xlabel(0 (0.1) 1, gmin gmax) legend(off) ytitle("") title("FDP") name(FDP, replace)			
				
			* CDU/CSU 
			estimates restore m1
			margins, at(vote_nat_w25_wabst_ord=(4) factor_econ_st=(0 (0.1) 1))	
				marginsplot, addplot(hist factor_econ_st if vote_nat_w25_wabst_ord==4 & e(sample) [fweight=voteweight_mult], ///
				fraction bin(11) yaxis(2) yscale(alt range(0 0.5) lstyle(none) axis(2)) ytitle(" ", size(zero) axis(2)) ///
				ylabel(none, axis(2)) xlabel(0 (0.1) 1, gmin gmax) fcolor(%20) lcolor(%20)) ///
				recast(line) recastci(rarea) ///
				xlabel(0 (0.1) 1, gmin gmax) legend(off) ytitle("") title("CDU/CSU") name(Union, replace)			
						
		* combine for right parties		
			graph combine AfD FDP Union, imargin(vsmall) row(1) iscale(*1.2) ysize(6) ycommon name(RightParties, replace)		
		
		* combine all
			graph combine LeftParties RightParties, row(2) iscale(*1.2) name(Figure7, replace)
				graph export Figure7.jpg, width(5000) fontface(TimesNewRoman) replace	
				graph export Figure7.pdf, replace				
			
			
			
**# Bookmark #6			
********************************************************************************	
**************************** ROBUSTNESS CHECKS *********************************
********************************************************************************			
		
***** Figure B3: Marginal effects on BSW voting intention by previous voting intention with additional control Wagenknecht rating
	logit BSWvote_nat ///
				c.factor_econ_st##i.vote_nat_w25_wabst_ord ///
				c.factor_glob_st##i.vote_nat_w25_wabst_ord ///
				c.factor_morality_st##i.vote_nat_w25_wabst_ord ///
				c.populism_st##i.vote_nat_w25_wabst_ord ///
				c.RussoUkraineWar_st##i.vote_nat_w25_wabst_ord ///
				c.Wagenknecht_st##i.vote_nat_w25_wabst_ord ///
				i.male i.agegroup i.edu_cat ib1.east [pweight=voteweight]
				eststo m2
					estadd fitstat	
									
		estimates restore m2
		margins, dydx(factor_econ_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo economic
		
		estimates restore m2
		margins, dydx(factor_glob_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo transnational			
			
		estimates restore m2
		margins, dydx(factor_morality_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo morality			

		estimates restore m2
		margins, dydx(populism_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo populism
		
		estimates restore m2
		margins, dydx(RussoUkraineWar_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo war			
			
		estimates restore m2
		margins, dydx(Wagenknecht_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo Wagenknecht				
			
		coefplot transnational, bylabel("transnational dim.") || economic, bylabel("economic dim.") || morality, bylabel("morality dim.") ///
			|| populism, bylabel("populism") || war, bylabel("Russo-Ukrainian War") || Wagenknecht, bylabel("Wagenknecht rating") ///
			coeflabel(8._at="no intention to vote" 7._at="others" 6._at="AfD" 5._at="FDP" 4._at="CDU/CSU" 3._at="SPD" 2._at="Greens" 1._at="LEFT") ///
			byopts(rows(2)) xline(0) level(95 90) ///
			name(FigureB3, replace)	

		graph combine FigureB3, scale(*1.1) name(FigureB3, replace)
				

				
***** Figure B4: Marginal effects on BSW voting intention by previous voting intention (measured in wave 24/May 2023)
		* vote intention variable in particular order
		recode vote_nat_w24_wabst (5=1 "LEFT") (4=2 "Greens") (2=3 "SPD") (1=4 "CDU/CSU") (3=5 "FDP") ///
			(6=6 "AfD") (8=7 "others") (9=8 "no intention to vote"), gen(vote_nat_w24_wabst_ord)		
					
		logit BSWvote_nat ///
				c.factor_econ_st##i.vote_nat_w24_wabst_ord ///
				c.factor_glob_st##i.vote_nat_w24_wabst_ord ///
				c.factor_morality_st##i.vote_nat_w24_wabst_ord ///
				c.populism_st##i.vote_nat_w24_wabst_ord ///
				c.RussoUkraineWar_st##i.vote_nat_w24_wabst_ord ///
				i.male i.agegroup i.edu_cat ib1.east [pweight=voteweight]
				eststo m1
					estadd fitstat	
	
		estimates restore m1
		margins, dydx(factor_econ_st) at(vote_nat_w24_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo economic
		
		estimates restore m1
		margins, dydx(factor_glob_st) at(vote_nat_w24_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo transnational			
			
		estimates restore m1
		margins, dydx(factor_morality_st) at(vote_nat_w24_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo morality			

		estimates restore m1
		margins, dydx(populism_st) at(vote_nat_w24_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo populism
		
		estimates restore m1
		margins, dydx(RussoUkraineWar_st) at(vote_nat_w24_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo war				
		
		coefplot transnational, bylabel("transnational dim.") || economic, bylabel("economic dim.") || morality, bylabel("morality dim.") ///
			|| populism, bylabel("populism") || war, bylabel("Russo-Ukrainian War") ///
			coeflabel(8._at="no intention to vote" 7._at="others" 6._at="AfD" 5._at="FDP" 4._at="CDU/CSU" 3._at="SPD" 2._at="Greens" 1._at="LEFT") ///
			byopts(rows(2)) xline(0) level(95 90) ///
			name(FigureB4, replace)
			
		graph combine FigureB4, scale(*1.1) name(FigureB4, replace)
				
				
		
***** Figure B5: Marginal effects on BSW voting intention by previous voting intention with switchers to other parties excluded
	gen stayers=1 if vote_nat_w25_wabst==vote_nat_w26_wabst

	logit BSWvote_nat ///
				c.factor_econ_st##i.vote_nat_w25_wabst_ord ///
				c.factor_glob_st##i.vote_nat_w25_wabst_ord ///
				c.factor_morality_st##i.vote_nat_w25_wabst_ord ///
				c.populism_st##i.vote_nat_w25_wabst_ord ///
				c.RussoUkraineWar_st##i.vote_nat_w25_wabst_ord ///
				i.male i.agegroup i.edu_cat ib1.east [pweight=voteweight] ///
				if stayers==1 | BSWvote_nat==1
				eststo m1
					estadd fitstat	
					
		estimates restore m1
		margins, dydx(factor_econ_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo economic
		
		estimates restore m1
		margins, dydx(factor_glob_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo transnational			
			
		estimates restore m1
		margins, dydx(factor_morality_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo morality			

		estimates restore m1
		margins, dydx(populism_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo populism
		
		estimates restore m1
		margins, dydx(RussoUkraineWar_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo war				
		
		coefplot transnational, bylabel("transnational dim.") || economic, bylabel("economic dim.") || morality, bylabel("morality dim.") ///
			|| populism, bylabel("populism") || war, bylabel("Russo-Ukrainian War") ///
			coeflabel(8._at="no intention to vote" 7._at="others" 6._at="AfD" 5._at="FDP" 4._at="CDU/CSU" 3._at="SPD" 2._at="Greens" 1._at="LEFT") ///
			byopts(rows(2)) xline(0) level(95 90) ///
			name(FigureB5, replace)
			
		graph combine FigureB5, scale(*1.1) name(FigureB5, replace)	
						
				
				
***** Figure B6: Marginal effects on BSW vote choice in European Parliament election by previous voting intention
	logit BSWvote_EU ///
				c.factor_econ_st##i.vote_nat_w25_wabst_ord ///
				c.factor_glob_st##i.vote_nat_w25_wabst_ord ///
				c.factor_morality_st##i.vote_nat_w25_wabst_ord ///
				c.populism_st##i.vote_nat_w25_wabst_ord ///
				c.RussoUkraineWar_st##i.vote_nat_w25_wabst_ord ///
				i.male i.agegroup i.edu_cat ib1.east [pweight=voteweight] 
				eststo m1
					estadd fitstat	
					
		estimates restore m1
		margins, dydx(factor_econ_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo economic
		
		estimates restore m1
		margins, dydx(factor_glob_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo transnational			
			
		estimates restore m1
		margins, dydx(factor_morality_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo morality			

		estimates restore m1
		margins, dydx(populism_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo populism
		
		estimates restore m1
		margins, dydx(RussoUkraineWar_st) at(vote_nat_w25_wabst_ord=(1 2 3 4 5 6 7 8))  post
			eststo war				
		
		coefplot transnational, bylabel("transnational dim.") || economic, bylabel("economic dim.") || morality, bylabel("morality dim.") ///
			|| populism, bylabel("populism") || war, bylabel("Russo-Ukrainian War") ///
			coeflabel(8._at="no intention to vote" 7._at="others" 6._at="AfD" 5._at="FDP" 4._at="CDU/CSU" 3._at="SPD" 2._at="Greens" 1._at="LEFT") ///
			byopts(rows(2)) xline(0) level(95 90) ///
			name(FigureB6, replace)
			
		graph combine FigureB6, scale(*1.1) name(FigureB6, replace)	
		